<?php

namespace App\Services\Bankcard;

use App\Services\ProjectValidate;

/**
 * 银行卡验证
 * Class ValidateBankcard
 * @package App\Services\Bankcard
 */
class ValidateBankcard extends ProjectValidate
{

    /**
     * 自定义子类初始化
     * @param array $initData
     * @return mixed
     */
    public function initValidate($initData = [])
    {
        if (!empty($initData['status'])) {
            $this->rules['status'] = 'in:1,2';
        }
    }

    /**
     * @var array 验证规则集合
     */
    public $rules = [
        'id'            => 'integer|min:1',
        'user_id'       => 'integer|min:1',
        'account'       => 'min:2',
        'name'          => 'min:2',
        'name_en'       => 'in:CCB,ABC,ICBC,BOC,OTHER',
        'number'        => 'min:15|max:19',
        'status'        => 'in:0,1,2'
    ];

    /**
     * @var array 当前验证错误信息
     */
    public $messages = [

    ];
}